package com.example.word.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author yuwen
 * @date 2023/4/17
 */
@Getter
@AllArgsConstructor
public enum FontSizeEnum {


    CHUHAO(42.0f,"初号"),

    XIAOCHU(36.0f, "小初"),

    YIHAO(26.0f, "一号"),

    XIAOYI(24.0f, "小一"),

    ERHAO(22.0f, "二号"),

    XIAOER(18.0f, "小二"),

    SANHAO(16.0f, "三号"),

    XIAOSAN(15.0f, "小三"),

    SIHAO(14.0f, "四号"),

    XIAOSI(12.0f, "小四"),

    WUHAO(10.5f, "五号"),

    XIAOWU(9.0f, "小五"),

    LIUHAO(7.5f, "六号"),

    XIAOLIU(6.5f, "小六"),

    QIHAO(5.5f, "七号"),

    BAHAO(5.0f, "八号");

    /**
     * 字体大小
     */
    private final float fontSize;

    /**
     * 字体大小对应名称
     */
    private final String fontName;

    public static String getFontName(float size){
        for (FontSizeEnum value : FontSizeEnum.values()) {
            if(value.getFontSize() == size){
                return value.getFontName();
            }
        }
        return null;
    }
}
